package com.chukun.module.use;

import com.chukun.module.inf.Digest;
import com.chukun.module.inf.Returned;

/**
 * @author chukun
 * @version 1.0.0
 * @description 用户使用案例
 * @createTime 2022年06月06日 22:27:00
 */
public class ModuleDigestUserCase {

    public static void main(String[] args) {

        Returned<Digest> returned = Digest.of("SHA-256");
        if (returned instanceof Returned.ReturnValue rv) {
            Digest digest = (Digest) rv.returnValue();
            byte[] digestedValue = digest.digest("hello,java.platform.module.system".getBytes());
            System.out.println("digested.value : " + new String(digestedValue));
        } else if (returned instanceof Returned.ErrorCode code) {
            System.err.println("digest.load.error,code : " + code);
        }
    }

}
